package com.jiantong.user.impl.service;

import com.jiantong.user.impl.dao.RoleModlueDao;
import com.jiantong.user.model.RoleModlue;
import com.jiantong.user.service.RoleModlueWriteService;
import io.terminus.boot.rpc.common.annotation.RpcProvider;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by ThinkPad on 2017/8/10.
 */
@Slf4j
@Service
@RpcProvider
public class RoleModlueWriteServiceImpl implements RoleModlueWriteService {

    private final RoleModlueDao roleModlueDao;

    @Autowired
    public RoleModlueWriteServiceImpl(RoleModlueDao roleModlueDao) {
        this.roleModlueDao = roleModlueDao;
    }
    @Override
    public Integer creates(List<RoleModlue> roleModlues) {

        try {
            return  roleModlueDao.creates(roleModlues);
        }catch (Exception e){
            return -1;
        }

    }

    @Override
    public Integer deletes(List<Long> list) {
        try {
            return  roleModlueDao.deletes(list);
        }catch (Exception e){
            return -1;
        }
    }

    @Override
    public Boolean delByModuleIdAndRoleId(Map criteria) {
        return roleModlueDao.delByModuleIdAndRoleId(criteria);
    }
}
